package com.gmail.blackdog1987.onedollar.dao;

import com.gmail.blackdog1987.onedollar.dao.hibernate.EntityHibernateDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.BaseJdbcDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.JdbcUtil;
import com.gmail.blackdog1987.onedollar.entity.TOrderGoodsEntity;
import com.gmail.blackdog1987.onedollar.entity.TOrderInfoEntity;
import com.gmail.blackdog1987.onedollar.vo.OrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("orderGoodsDao")
public class OrderGoodsDao extends EntityHibernateDao<TOrderGoodsEntity>{
    @Autowired
    private BaseJdbcDao baseJdbcDao;

    public List<TOrderGoodsEntity> queryByIds(String orderid){
        String sql =
                "SELECT * \n";
        String where =
                "                FROM t_order_goods\n" +
                        "                WHERE t_order_goods.order_id in (?)\n";
        Object [] args = new Object[]{orderid};

        return JdbcUtil.queryForList(baseJdbcDao, TOrderGoodsEntity.class, sql + where, args);
    }
}
